function getNumsSum(arr) {
    var sum = 0;
    for (var i = 0; i < arr.length; i++) {
        // arr[i]
        if (!isNaN(arr[i])) {
            sum += +arr[i];
        }
    }
    return sum;
}

function getNumsSum(arr) {
    var nums = arr.filter(item => !isNaN(item));
    var sum = 0;
    for (var num of nums) {
        sum += +num;
    }
    return sum;
}

// 之后讲
function getNumsSum() {
    return arr
        .filter(item => !isNaN(item))
        .reduce((prev, current) => prev + current, 0);
}

console.log(getNumsSum(['a', 'b', 'c'])); // 0
console.log(getNumsSum(['a', 'b', '', 1, 100])); // 101
console.log(getNumsSum(['a', 'b', 1, 2, '3'])); // 6
console.log(getNumsSum([1, 'b', null])); // 1
